﻿var globalAnimationDuration = 1000;

//Init Metro Tiles click effect
function InitMetroTilesClickEffect() {

    var tileScale = 2;

    $(".MetroTile .Content.Clickable").mousedown(function () {
        $(this).css("opacity", "0.5");
    }).mouseup(function () {
        $(this).css("opacity", "");
    }).mouseout(function () {
        $(this).css("opacity", "");
    });

};

var colorChangeTimingRange = new Range(10000, 30000);
function InitMetroTilesColouringEffect() {
    $(".MetroTile .Content").each(function () {
        var tileJq = $(this);
        tileJq.css("background-color", Kuler.FetchNextColor());
        setTimeout(MetroTilesChangeColor, colorChangeTimingRange.RandomInt(), tileJq);
    });
};
function MetroTilesChangeColor(tileJq) {
    if (!tileJq)
        return;
    tileJq.stop().animate({ "background-color": Kuler.FetchNextColor() }, globalAnimationDuration);
    setTimeout(MetroTilesChangeColor, colorChangeTimingRange.RandomInt(), tileJq);
};

function InitInlineContent() {
    $(".InlineContent").closest(".hDUnivSim_UniverseEntity").css('height', 'auto');
};

function InitTooltipsy() {
    $(".MetroTile .Content").tooltipsy();
};

$(function () {
    InitMetroTilesColouringEffect();
    InitMetroTilesClickEffect();
    InitInlineContent();
    InitTooltipsy();
});